import 'package:flutter/material.dart';

final navigationBarItems = <BottomNavigationBarItem>[
  BottomNavigationBarItem(
      icon: Image.asset("assets/bottom_bar/find.png"),
      label: '发现',
      activeIcon: Image.asset("assets/bottom_bar/find_active.png")),
  BottomNavigationBarItem(
      icon: Image.asset("assets/bottom_bar/mine.png"),
      label: '我的',
      activeIcon: Image.asset("assets/bottom_bar/mine_active.png")),
];

const theme_color = Color(0xFF1AFF29);

void main() {
  runApp(RaApp());
}

class RaApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'RaMusic',
      theme: ThemeData(iconTheme: IconThemeData(color: theme_color)),
      home: RaHomePage(title: '首页'),
      routes: {'': (context) => RaHomePage(title: '首页')},
    );
  }
}

class RaHomePage extends StatefulWidget {
  RaHomePage({Key? key, required this.title}) : super(key: key);

  final String title;

  @override
  _RaHomePageState createState() => _RaHomePageState();
}

class _RaHomePageState extends State<RaHomePage> {
  var _currentIndex = 0;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      bottomNavigationBar: BottomNavigationBar(
        currentIndex: _currentIndex,
        onTap: (currentIndex) {
          setState(() {
            _currentIndex = currentIndex;
          });
        },
        items: navigationBarItems,
        selectedLabelStyle: TextStyle(color: Colors.black),
        selectedItemColor: theme_color,
      ),
    );
  }
}
